Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiline text #677

Merged
merged 12 commits into from
Jan 19, 2022
Merged

multiline text #677

merged 12 commits into from
Jan 19, 2022

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Jan 17, 2022

Supersedes #327. Fixes #313. This…

  • Standardizes the dx and dy options on text; only pixel values are now supported (no typographic units).
  • Adds a new lineAnchor option to control vertical alignment; one of top, middle (default), or bottom.
  • Adds a new lineHeight numeric option to control vertical spacing between lines; defaults to 1.0.
  • Always positions the text using the transform attribute rather than x and y (even when not rotating).

TODO

  • Generate multiple tspans for multiline text
  • Standardize dx and dy options
  • Add lineAnchor option
  • Add lineHeight option
  • Use x and y attributes if not rotating (for more minimal output or performance)?
  • Test
  • Document

@mbostock mbostock requested a review from Fil January 17, 2022 20:50
Fil and others added 2 commits January 19, 2022 08:09
* use x, y and dy when there is no rotate
test multiline (with 1 empty line)
document

* use selection.call to branch

* remove duplicate test

Co-authored-by: Mike Bostock <[email protected]>
@mbostock mbostock mentioned this pull request Jan 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plot.text could be smart with newlines
2 participants